/*!
\file Platform.h
\author Po
\brief A flat cube can orbit the Y axis at the world center.
*/
#pragma once

#include <d3d9.h>
#include <d3dx9.h>
#include "Interface.h"

/*!
\class Platform
\brief A flat cube can orbit the Y axis at the world center.
*/
class Platform : public Target
{
public:
	/*! Construct a platform with IDirect3DDevice9 (<b>NOT</b> own this device). */
	Platform(IDirect3DDevice9 *pd3dDevice);
	/*! Destruct this platform. */
	~Platform(void);

public:
	/*! Should set radius before Platform::Update() */
	void SetOrbitRadius(float fRadius);
	/*! Get the platform width. */
	float Width() const;
	/*! Get the platform height. */
	float Height() const;
	/*! Get the platform depth. */
	float Depth() const;

public:
	const D3DXVECTOR3 &Position() const;
	const D3DXVECTOR3 &Look() const;
	const D3DXMATRIX &World() const;

public:
	void UpdateRotationY(float fAngle);
	/*! Should call this function one frame a time. */
	void Update();

private:
	Platform(const Platform &);
	Platform &operator=(const Platform &);

private:
	LPDIRECT3DDEVICE9 m_pd3dDevice;
	LPD3DXMESH m_pCube;
	D3DXMATRIX m_matWorld;
	D3DXVECTOR3 m_vecPosition;
	D3DXVECTOR3 m_vecLook;

	float m_fWidth;
	float m_fHeight;
	float m_fDepth;

	float m_fRadius;
	float m_fAngle;
	float m_fRotationAngleY;
};

